import authapi from './authapi'

/* eslint-disable */
export const GetRoleList = () => {
  let api = new authapi('getRole')

  return api.Send({}, {})
}

export const AddRole = (name, description) => {
  let api = new authapi('addRole')

  let param = {
    'name': name,
    'description': description,
    // 'status': 1,
    // 'ext_infos': {}
  }

  return api.Send({}, param)
}

export const GetRoleById = (id) => {
  let api = new authapi('getRole')

  let argList = [id]

  return api.Send({}, {}, argList)
}

export const UpdateRole = (id, name, description, states = 1) => {
  let api = new authapi('putRole')
  let param = {
    'name': name,
    'description': description,
    'id': id
  }

  let argList = []

  return api.Send({}, param, argList)
}

export const DeleteRole = (id) => {
  let api = new authapi('delRole')

  let argList = [id]

  return api.Send({}, {}, argList)
}

export const GetUserById = (id) => {
  let api = new authapi('getUser')

  let argList = [id, 'users']

  return api.Send({}, {}, argList)
}

export const UpdateUser = (id, idList) => {
  let api = new authapi('putUser')

  let param = idList

  let argList = [id, 'users']

  return api.Send({}, param, argList)
}

export default {
  GetRoleList,
  AddRole,
  GetRoleById,
  UpdateRole,
  DeleteRole,
  GetUserById,
  UpdateUser
}
